# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pytorctl
pkgname=('python2-pytorctl' 'python-pytorctl')
_pkgname=pytorctl
pkgver=2013.10.16.4.gc8fcb25
pkgrel=10
pkgdesc='A Python Tor controller with extensions to support path building and various constraints on node and path selection, as well as statistics gathering.'
arch=('any')
url='http://fscked.org/projects/torctl'
license=('custom:unknown')
makedepends=('git' 'python2-setuptools' 'python-setuptools')
optdepends=('python2-elixir: SQL Support')
conflicts=('pytorctl')
provides=('pytorctl')
source=("git+http://git.torproject.org/$_pkgname.git"
        'setup.py')
sha512sums=('SKIP'
            'bfa1696c63935fa49d8f5aad9d8d2735e882cddb9565e2d9f59d063aab55bbf2112df46a99aaefd9c9a22432fbfff4b9f2376f5394d348c6b18015a53126f10e')

pkgver() {
  cd $_pkgname

  git describe --always | sed 's|-|.|g'
}

package_python2-pytorctl() {
  depends=('python2' 'python2-geoip')

  install -dm 755 "$pkgdir/usr/share/"{licenses,doc}"/${pkgname[0]}"

  install -Dm 644 "$srcdir/$_pkgname/README" \
    "$pkgdir/usr/share/doc/${pkgname[0]}"

  install -Dm 644 "$srcdir/$_pkgname/LICENSE" \
    "$pkgdir/usr/share/licenses/${pkgname[0]}/LICENSE"


  python2 setup.py install --root="$pkgdir" --optimize=1
}

package_python-pytorctl() {
  depends=('python' 'python-geoip')

  install -dm 755 "$pkgdir/usr/share/"{licenses,doc}"/${pkgname[1]}"

  install -Dm 644 "$srcdir/$_pkgname/README" \
    "$pkgdir/usr/share/doc/${pkgname[1]}"

  install -Dm 644 "$srcdir/$_pkgname/LICENSE" \
    "$pkgdir/usr/share/licenses/${pkgname[1]}/LICENSE"

  python setup.py install --root="$pkgdir" --optimize=1
}

